<div style="margin:10px" class="div_form_content" >
    <div class="div_form_content">
        <h3><?=$row['title']?></h3>
        <br/>
        <div><a href="index.php?m=manage_solution&a=edit&sid=<?=$row['idsolutions']?>" style="text-decoration:!important;float:left; color:#3CF">Edit</a>&nbsp;|&nbsp;<a href="javascript:deleteSolution(<?=$row['idsolutions']?>)" style="text-decoration:!important; color:#3CF">Delete</a></div>
        <div class="article-hearder">
            <span style="margin-left:100px; font-size: 12px;color: #aaa;float: right">
                <label><img src="../images/view.png" ><b> <?=$row['view']?></b></label>
                -
                <label><img src="../images/comment.png" > <b><?=$row['comment']?></b></label>
            </span>
        </div>
    
        <div class="article-single">
        <span><?=$row['detail']?></span>
        </div>
    
        <div class="article-footer">

            <div class="user-details">
                <?$time=elapsed_time($row['ctime']);?>
                        <div  id ="user-info">
                            <span style="color: #aaa" title="Posted in"><b>posted <?=$time?> by</b></span>
                            <a href="" style="text-decoration: none"><b><?=$row['user_name']?></b></a><br>

                        </div>
            </div>
            <div style="clear: both"></div>
        </div>
    
        <div id="comment">
           <div id="comment-main">
            <h5><?=$row['comment']?> Comments</h5>

            <?if(isset($posts)):?>
            <?  foreach ($posts as $com):?>
            <div id="comment-single">
            <span id="com_content_<?=$com['idcomment']?>"> <?=$com['comment']?></span></br>

            </div>

            <div id="comment-footer">
                 <div id="article-footer">

                    <div class="user-details">
                                <div id="user-image">
                                    <span style="color: #aaa" title="Posted in"><b>posted <?=elapsed_time($com['ctime'])?> by</b></span>
                                    <img  src=".<?=$com['avatar']?>"/>
                                </div >
                                <div  id ="user-info">
                                    <a href="" style="text-decoration: none"><b><?=$row['user_name']?></b></a><br>
                                </div>
                    </div>
                </div>
            </div>
            <?endforeach?>
            <?endif?>
            </div>

        </div>
        
        
        
       <div id="post-comment-wrapper">
            <div id="post-comment">
                
                <h3>Leave your comment here:</h3> 
                <div style="margin: 10px 15px;">
                <div id="status1" style="color:red;"></div>
                <div id="sending" style="margin-left: 20px;">
            		<img src="../images/loading.gif" id="loading">
                </div>
                <textarea id="post-comment-textarea" class="input-comment-textarea"  ></textarea>
                
                <input type="button" value="Submit" class="button" onclick="Save();"/> &nbsp;&nbsp;<input type="button" value="Reset" onClick="Reset();" class="button"/>
                
                </div>
            </div>
           
        </div>
                        
                        
        
    </div>
    
</div>
<script>
	function deleteSolution(s_id){
    var conf = confirm("Are you sure you want to delete this Solution?");
    if(conf == true){
         var url="index.php?m=manage_solution&a=delete&s_id="+s_id;
         window.location=url;
         //alert (url);
    	}
	}
	
	$(document).ready(function() {
    $('#sending').hide();
});  

function Reset(){
    $('#post-comment-textarea').val('');
}

function Save(){
    var comment=$('#post-comment-textarea').val();
	var commentator=<?php echo $row['user_id']?>;
	var idsolution=<?php echo $row['idsolutions']?>;
    //alert(title);
    if(comment==""){
        $("#status1").html('Comment empty! (*)');
    }else{
        $('#sending').show();
        $.ajax({
          
          url: '<?=WEBSITE_URL?>/ajax.php',
          data: { m: 'manage_solution', a:'create_comment_solution',comment:comment, commentator:commentator, idsolution:idsolution},
          dataType:'json',
          success: function(data) {
            if (!data.success) {
                $("#status1").html('Save the comment failed');
               //alert(data.error);
               return false;

            }else{
                //$('#noidung_tin').html('Đã lưu');
                $("#status1").html('Save the comment success');
                $('#sending').hide();
				//window.location="index.php?m=manage_solution&a=view&sid=" + idsolution;
				//$.load('#comment');
                //$('#send').hide();
                //window.location("index.php?m=manage_solution");
            }
            //Update info
          } 
         
        });
    }

}
</script>